package com.ternnetwork.core.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.ternnetwork.persistence.dao.impl.IBaseDaoImpl;
import com.ternnetwork.core.dao.UserDao;
import com.ternnetwork.core.entity.User;






@Repository("userDao")
public class UserDaoImpl extends IBaseDaoImpl<User> implements UserDao {

	@Override
	public User findByName(String username) {
		List<User> list=super.findAll("from User t where t.name=?1",username);
		if(list.size()>0){
			return list.get(0);
		}
		return null;
	}
	@Override
	public User findWechatId(String wechatId) {
		List<User> list=super.findAll("from User t where t.wechatId=?1",wechatId);
		if(list.size()>0){
			return list.get(0);
		}
		return null;
	}

}
